package com.ycz.pattern.structure.compositepattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description
 * @ClassName Employee
 * @Author yanchengzhi
 * @date 2023.11.27 00:24
 */
public class Employee {

    private String name;
    private String dept;
    private int salary;
    // 叶子结点
    private List<Employee> employeeList = new ArrayList<>();

    public Employee(String name,String dept,int salary) {
        this.name = name;
        this.dept = dept;
        this.salary = salary;
    }

    public void add(Employee employee) {
        employeeList.add(employee);
    }

    public void remove(Employee employee) {
        employeeList.remove(employee);
    }

    public List<Employee> getEmployeeList() {
        return employeeList;
    }

    @Override
    public String toString() {
        return "Employee：【Name：" + name + "，dept：" + dept + "，salary：" + salary + "】";
    }
}
